#ifndef F2475D59_C634_4413_98B6_0299A8CB8C53
#define F2475D59_C634_4413_98B6_0299A8CB8C53
#ifndef D5B1940D_9042_49A8_B4A2_7421439713FF
#define D5B1940D_9042_49A8_B4A2_7421439713FF

#endif /* D5B1940D_9042_49A8_B4A2_7421439713FF */

#include <iostream>
#include <pthread.h>
#include <string.h>
namespace ns_task
{
    class Task
    {
    private:
        int x_;
        int y_;
        char op_;

    public:
        Task() {}
        Task(int x, int y, char op)
            : x_(x), y_(y), op_(op)
        {
        }
        
        std::string Show()
        {
            //转化为字符串
            std::string message=std::to_string(x_);
            message+=op_;
            message+=std::to_string(y_);
            message+="=?";
            return message;
        }
        
        int Run()
        {
            int res = 0;
            switch (op_)
            {
            case '+':
                res = x_ + y_;
                break;
            case '-':
                res = x_ - y_;
                break;
            case '*':
                res = x_ * y_;
                break;
            case '/':
                res = x_ / y_;
                break;
            default:
                std::cout<<"wrong..."<<std::endl;
                break;
            }
            std::cout<<"当前任务被："<<pthread_self()<<"处理"<<x_<<op_<<y_<<"="<<res<<std::endl;
            return res;
        }

        int operator() ()
        {
            return Run();
        }

        ~Task() {}
    };
}


#endif /* F2475D59_C634_4413_98B6_0299A8CB8C53 */
